package com.zxl.manager.service.impl;

import com.zxl.manager.dao.ProductDao;
import com.zxl.manager.entity.Product;
import com.zxl.manager.entity.ProductDetail;
import com.zxl.manager.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by jimmy on 2017/7/9.
 */
@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductDao productDao;

    public List<Product> getAllProd(){
        return productDao.getAllProd();
    }

    public int insProd(Product product){
        return productDao.insProd(product);
    }

    public int updProd(Product product){
        return productDao.updProd(product);
    }

    public int delProd(String ids){
        int res = productDao.delProdDet(ids);
        return productDao.delProd(ids);
    }

    public List<ProductDetail> getProdDet(String proId){
        return productDao.getProdDet(proId);
    }

    public int insProdDet(List<ProductDetail> pdlist){
        Integer res = 0;
        for(ProductDetail pd : pdlist){
            res = productDao.insProdDet(pd);
        }
        return res;
    }
}
